<?php

namespace App\Models;

class RedRain extends Model
{
    protected $table = 'yf_red_rain';
    protected $primaryKey = 'rain_id';
    public $timestamps = false;
    protected $guarded = ['rain_id'];

    public static function getOneAsArray() : array
    {
        $res = self::selectRaw('*, IF(sttime>NOW() || edtime<NOW(), 1, 0) as status')
            ->whereTypes(1)
            ->first();

        return $res ? $res->toArray() : [];
    }
}
